package com.ruoyi.framework.webchat.runner;

import com.ruoyi.system.service.wechat.IWechatAdministrativeUnitService;
import com.ruoyi.system.service.wechat.IWechatPostService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 微信小程序系统数据缓存
 *
 * @author jiexiang.sun/Jason
 * @version 1.0.0
 * @create 2022-03-04 22:16
 **/
@Component
@Slf4j
public class DataCacheRunner implements ApplicationRunner {

    @Autowired
    private IWechatPostService wechatPostService;

    @Autowired
    private IWechatAdministrativeUnitService administrativeUnitService;

    @Override
    public void run(ApplicationArguments args) {
        log.info("开始初始化省市区数据到缓存");
        administrativeUnitService.loadAdministrativeUnitCache();
        log.info("初始化省市区数据到缓存完成");
    }
}
